package com.larry.spark.rdd.transform

import org.apache.spark.{SparkConf, SparkContext}

object RDD_Oper_FlatMap {

  def main(args: Array[String]): Unit = {
    //TODO  使用spark

    val conf = new SparkConf().setMaster("local[*]").setAppName("rdd")
    val sc = new SparkContext(conf)

    val rdd = sc.makeRDD(
      List("hello scala", "hello spark")
    )

    //扁平化  整体->拆分后的个体(容器)
    val rdd1 = rdd.flatMap(_.split(" "))

    rdd1.collect().foreach(println)

    sc.stop()
  }
}
